Imports BestCarings_TuyenDung.Business.Domain
Imports BestCarings_TuyenDung.Data.Persistence
Imports TDevFramework

Public Class TuyenDung_AutoAproveThread
    Private _t As New Timer()
    Private Shared _me As TuyenDung_AutoAproveThread

    Public Shared sw As New System.IO.StreamWriter("d:\timer.txt")
    Public Shared isRunning As Boolean = False

    Public Shared Function getInstance() As TuyenDung_AutoAproveThread
        If _me Is Nothing Then
            _me = New TuyenDung_AutoAproveThread()
        End If
        Return _me
    End Function
    
    Public Sub StartThread()
        isRunning = True
        _t.Interval = 3000
        _t.Enabled = True
        AddHandler _t.Tick, AddressOf approve
    End Sub

    Public Sub StopThread()
        Try
            isRunning = False
            'sw.Close()
            _t.Stop()
        Catch ex As Exception

        End Try
    End Sub

    Private Sub approve(ByVal obj As Object, ByVal ergs As EventArgs)
        'Dim dnow As Date = Now()
        'Dim ts As TimeSpan = dnow.Subtract(New Date(2012, 1, 9))

        'If ts.Days > 0 Then
        '    sw.WriteLine("OK")
        'Else
        '    sw.WriteLine("Not OK")
        'End If

    End Sub



End Class
